package com.lq.ecoldchain.ui.goodstype

import com.alibaba.android.arouter.facade.annotation.Route
import com.lq.ecoldchain.R
import com.lq.ecoldchain.base.BaseNavigator
import com.lq.ecoldchain.base.view.BaseActivity
import com.lq.ecoldchain.databinding.ActivityGoodsTypeBinding
import com.lq.ecoldchain.entity.EventAll
import com.lq.ecoldchain.util.toast
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.kodein.di.Kodein
import org.kodein.di.generic.instance

/*
*2019/1/10 0010  11:46
*function by lq
*/
@Route(path = BaseNavigator.goodsType)
class GoodsTypeListActivity:BaseActivity<ActivityGoodsTypeBinding>(){
    override val layoutId = R.layout.activity_goods_type
    override val viewDelegate: GoodsTypeDelegate by instance()

    override fun initView() {
        binding.delegate = viewDelegate
        titleText("商品类型")
        EventBus.getDefault().register(this)
    }

    override val kodein = Kodein.lazy {
        extend(parentKodein)
        import(goodsTypeKodeinModule)
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    fun goodsItemChangeEvent(event: EventAll.GoodsTypeItem) {
        finish()
    }

    override fun onDestroy() {
        super.onDestroy()
        EventBus.getDefault().unregister(this)
    }


}